首页> 外文OA文献 >A Design for Type-Directed Programming in Java
【2h】

A Design for Type-Directed Programming in Java

机译:Java类型导向程序设计

代理获取
本网站仅为用户提供外文OA文献查询和代理获取服务,本网站没有原文。下单后我们将采用程序或人工为您竭诚获取高质量的原文,但由于OA文献来源多样且变更频繁,仍可能出现获取不到、文献不完整或与标题不符等情况,如果获取不到我们将提供退款服务。请知悉。

摘要

Type-directed programming is an important and widely used paradigm in the design of software. With this form of programming, an application may analyze type information to determine its behavior. By analyzing the structure of data, many operations, such as serialization, cloning, adaptors and iterators may be defined once, for all types of data. That way, as the program evolves, these operations need not be updated—they will automatically adapt to new data forms. Otherwise, each of these operations must be individually redefined for each type of data, forcing programmers to revisit the same program logic many times during a program’s lifetime.The Java language supports type directed programming with the instanceof operator and the Java Reflection API. These mechanisms allow Java programs to depend on the name and structure of the run-time classes of objects. However, the Java mechanisms for type-directed programming are difficult to use. They also do not integrate well with generics, an important new feature of the Java language.In this paper, we describe the design of several expressive new mechanisms for type-directed programming in Java, and show that these mechanisms are sound when included in a language similar to Featherweight Java. Basically, these new mechanisms pattern-match the name and structure of the type parameters of generic code, instead of the run-time classes of objects. Therefore, they naturally integrate with generics and provide strong guarantess about program correctness. As these mechanisms are based on pattern matching, they naturally and succinctly express many operations that depend on type information. Finally, they provide programmers with some degree of protection for their abstractions. Whereas instanceof and reflection can determine the exact run-time type of an object, our mechanisms allow any supertype to be supplied for analysis, hiding its precise structure from others.
机译:在软件设计中,类型导向编程是一种重要且广泛使用的范例。通过这种形式的编程,应用程序可以分析类型信息以确定其行为。通过分析数据的结构,可以为所有类型的数据一次定义许多操作,例如序列化,克隆,适配器和迭代器。这样,随着程序的发展,无需更新这些操作-它们将自动适应新的数据格式。否则,必须针对每种数据类型分别重新定义每个操作,从而迫使程序员在程序生命周期内多次重访相同的程序逻辑。Java语言通过instanceof运算符和Java Reflection API支持类型定向编程。这些机制允许Java程序依赖于对象的运行时类的名称和结构。但是,用于类型定向编程的Java机制很难使用。它们还不能与泛型很好地集成,泛型是Java语言的一个重要的新功能。在本文中,我们描述了几种用于Java中的类型导向编程的表达性新机制的设计,并证明了将这些机制包含在Java中是合理的。与Featherweight Java类似的语言。基本上,这些新机制将模式匹配通用代码的类型参数的名称和结构,而不是对象的运行时类。因此,它们自然地与泛型集成,并为程序的正确性提供了强有力的保证。由于这些机制基于模式匹配,因此自然而简洁地表达了许多依赖类型信息的操作。最后,它们为程序员的抽象提供了一定程度的保护。尽管instanceof和Reflection可以确定对象的确切运行时类型,但是我们的机制允许提供任何超类型进行分析,而将其他对象的精确结构隐藏起来。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
代理获取

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号